home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
kowin
/
archive
/
kob
/
kob001s.lzh
/
ped.has
< prev
next >
Wrap
Text File
|
1996-03-03
|
7KB
|
472 lines
.include doscall.mac
* .include iocscall.mac
* .include fefunc.h
.include fdef.h
.text
.even
.dc.l ret
.dc.l ret
.dc.l mem開放
.dc.l mem開放
.dc.l mem開放
.dc.l ret
.dc.l ret
.dc.l ret
.dc.l ptr_token
.dc.l ptr_param
.dc.l ptr_exec
.dc.l 0,0,0,0,0
mem開放:
lea.l _ped_ptr(pc),a0
move.l (a0),-(sp)
ble @f
DOS _MFREE
clr.l (a0)
@@:
addq.l #4,sp
clr.l 4(a0) * ped_num
ret:
rts
ptr_token:
.dc.b 'toroku_ped',0
.dc.b 'draw_ped',0
.dc.b 0
.even
ptr_param:
.dc.l p_read_ped
.dc.l p_draw_ped
ptr_exec:
.dc.l e_read_ped
.dc.l e_draw_ped
p_read_ped:
.dc.w $0038 * ary1_str
.dc.w void_ret
p_draw_ped:
.dc.w int_val * wno
.dc.w int_val * #
.dc.w int_val * x
.dc.w int_val * y
.dc.w void_ret
** ** ** ** ** ** ** ** ** **
error .macro mes,num
.local l1
lea.l l1(pc),a1
moveq #num,d0
rts
l1: .dc.b mes,0
.even
.endm
.dc.w irr_format-te
.dc.w no_mem-te
.dc.w not_exist_file-te
te:
toroku_ped_err:
add.w d0,d0
move.w te(pc,d0.w),d0
jmp te(pc,d0.w)
irr_format:
lea.l irf1(pc),a1
lea.l irf2(pc),a0
bra 1f
not_exist_file:
lea.l nef1(pc),a1
lea.l nef2(pc),a0
1:
moveq #29,d0
@@:
move.b (a2)+,(a0)+
dbeq d0,@b
move.b #'"',-1(a0)
clr.b (a0)
moveq #3,d0
rts
nef1: .dc.b '指定のファイルがありません。"'
nef2: .ds.b 32
irf1: .dc.b 'PED ファイルのフォーマットがおかしいです "'
irf2: .ds.b 32
.even
yet_read_ped:
error 'すでに ped は読み込んでますよ',4
no_mem:
error 'メモリを確保出来ませんでした',1
not_read_ped:
error 'ped を登録していません',5
irregular_num:
error 'ped 番号が不正です',6
no_data_ped:
error 'その番号には ped は登録されていません',7
irregular_wno:
error 'Window Nunber がまずいです',2
** ** ** ** ** ** ** ** ** **
return_zero:
moveq.l #0,d0
return_d0:
lea.l fac(pc),a0
move.l d0,6(a0)
moveq.l #0,d0
rts
.even
fac:
.dc.w 0
.dc.l 0
.dc.l 0
** ** ** ** ** ** ** ** ** **
_ped_ptr:
.dc.l 0 * ptr ( 0,1,2,...,N )
* =0 の時未登録
_ped_num:
.dc.l 0 * ped の個数 (=N)
** ** ** ** ** ** ** ** ** **
_toroku_ped:
e_read_ped:
move.l _ped_ptr(pc),d0
bgt yet_read_ped * すでに登録済み
movea.l par1+6(sp),a2 * ファイル名リスト
addq.l #6,a2
moveq #0,d1
moveq #0,d2
movem.w (a2)+,d1/d2 * 各項のサイズ/添え字の大きさ
move.l #$c0_0000,-(sp)
DOS _MALLOC
andi.l #$ff_fff0,d0
move.l d0,d7 * メモリ確保量
move.l d0,(sp)
DOS _MALLOC * メモリ最大確保(後でSETBLOCKでサイズ再調整)
addq.l #4,sp
movea.l d0,a3
movem.l d0/d2,_ped_ptr
*move.l d2,_ped_num
bsr read_ped
bmi toroku_ped_err
movea.l _ped_ptr(pc),a3
suba.l a3,a4
movem.l a3/a4,-(sp)
DOS _SETBLOCK
addq.l #8,sp
bra return_zero
** ** ** ** ** ** ** ** ** **
* 読み込む
* a2 = file名list
* d1 = 各項のサイズ
* d2 = 項数 - 1
* a3 = buf先頭
* d7 = buf SIZE
read_ped:
* a3 = ped address list
* a4 = buf先頭
moveq #4,d0
add.w d2,d0
lsl.w #2,d0
sub.l d0,d7
bcs read_ped_nomem_err
lea.l (a3,d0.w),a4
read_ped_loop:
tst.b (a2)
bne @f
clr.l (a3)+ * 登録されず
bra 1f
@@:
clr.w -(sp)
move.l a2,-(sp)
DOS _OPEN
addq.l #6,sp
move.l d0,d6
bmi read_ped_fileopen_err
clr.w d5 *
* Sheet1
bsr search_middle
bmi read_ped_irregular_err
movea.l a4,a5
bsr get_sheet
bmi read_ped_irregular_err
bne read_ped_nomem_err
* Sheet2
bsr search_middle
bmi read_ped_irregular_err
movea.l a4,a6
bsr get_sheet
bmi read_ped_irregular_err
bne read_ped_nomem_err
* Sheet struct
bsr search_middle
bmi read_ped_irregular_err
subi.l #4*5,d7
bcs read_ped_nomem_err
move.l a4,(a3)+ * Sheet 登録
bsr get_dec * h
bmi read_ped_irregular_err
bsr get_dec * v
bmi read_ped_irregular_err
bsr get_dec * hword
bmi read_ped_irregular_err
move.l a5,(a4)+ * sheet1
move.l a6,(a4)+ * sheet2
bsr close_d6
1:
adda.l d1,a2
dbra d2,read_ped_loop
moveq #0,d0
rts
read_ped_irregular_err:
moveq #-3,d0
rts
read_ped_nomem_err:
moveq #-2,d0
rts
read_ped_fileopen_err:
moveq #-1,d0
rts
search_middle: * '{' を探す
bsr get1byte
beq format_err
cmpi.b #'{',d0
bne search_middle
rts
* ファイルを読んで 0x???? を (a4) に書き込んで行く
* '}' が出るまで。
get_sheet:
bsr get1byte
beq format_err
cmpi.b #'x',d0
bne @f
subq.l #2,d7
bcs memory_err
bsr get_hex
move.w d0,(a4)+
bra get_sheet
@@:
cmpi.b #'}',d0
bne get_sheet
rts
get1byte:
subq.w #1,d5
bcc @f
lea.l tmp,a1
pea.l $400.w
move.l a1,-(sp)
move.w d6,-(sp)
DOS _READ
lea.l 10(sp),sp
move.l d0,d5
ble 1f
subq.w #1,d5
@@:
move.b (a1)+,d0
rts
1:
moveq #0,d0
rts
get_dec: * h, v, hword を得る
moveq #0,d3
moveq #0,d0
@@:
bsr get1byte
beq 1f
ext.w d0
ext.l d0
cmpi.w #'0',d0
bcs @b
cmpi.w #'9',d0
bhi @b
bra 2f
@@:
bsr get1byte
ext.w d0
ext.l d0
2:
subi.w #'0',d0
bcs 1f
cmpi.w #10,d0
bcc 1f
add.l d3,d3 * d3*10+d0
add.l d3,d0
lsl.l #2,d3
add.l d0,d3
bra @b
1:
move.l d3,(a4)+
cmpi.b #','-'0',d0
beq 1f
@@:
bsr get1byte
beq format_err
cmpi.b #',',d0
bne @b
1:
rts
get_hex:
moveq #0,d3
@@:
bsr get1byte
ext.w d0
ext.l d0
ori.b #$20,d0
subi.w #'0',d0
bcs 1f
cmpi.w #10,d0
bcs 2f
subi.w #'a'-'0'-10,d0
cmpi.w #$10,d0
bcc 1f
2:
lsl.l #4,d3
add.l d0,d3
bra @b
1:
move.l d3,d0
rts
format_err:
bsr close_d6
moveq #-1,d0
rts
memory_err:
bsr close_d6
moveq #1,d0
rts
close_d6:
move.w d6,-(sp)
DOS _CLOSE
addq.l #2,sp
rts
** ** ** ** ** ** ** ** ** **
DPut equ 2
_draw_ped:
e_draw_ped:
move.l _ped_ptr(pc),d0
ble not_read_ped
movea.l d0,a2
move.l par1+6(sp),d0 * wno
lsl.w #2,d0
move.l (a3,d0.w),d4 * _bwp[d0] = WP
beq irregular_wno
move.l par2+6(sp),d2 * ped NUMBER
bmi irregular_num
cmp.l _ped_num(pc),d2
bhi irregular_num
lsl.w #2,d2
move.l (a2,d2.w),d3 * Sheet
beq no_data_ped
move.l par3+6(sp),d1 * x
move.l par4+6(sp),d2 * y
lea.l DrawBuf(pc),a0
moveq #DPut,d0
movem.l d0/d1/d2/d3,(a0)
pea.l 1.w
movem.l d4/a0,-(sp) * WP/DBUF
movea.l (a4),a0 * _WindowDraw
jsr (a0)
lea.l 4*3(sp),sp
bra return_zero
DrawBuf:
.ds.b 28
** ** ** ** ** ** ** ** ** **
.if 0
file_exist:
lea.l -56(sp),sp
move.w #$23,-(sp) * A***HR
move.l a0,-(sp)
pea.l 6(sp)
DOS _FILES
tst.l d0
bmi nofile
move.l 10+26(sp),d0 *file_size
* move.l 10+22(sp),d1 *file_date&time
fe:
lea.l 10+56(sp),sp
rts
nofile:
moveq.l #0,d0
bra fe
.endif
** ** ** ** ** ** ** ** ** **
.bss
tmp:
.ds.b 1024
.end